﻿using Egg.EFCore.Dbsets;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GitMerger.Entities
{
    /// <summary>
    /// Git分支 
    /// </summary>
    public class GitBranch : AutoIncrementKeyEntity
    {
        private int _isEnable = 0;

        public void SaveIsEnableCache()
        {
            _isEnable = this.IsEnable;
        }

        public bool IsEnableChange()
        {
            return this.IsEnable != _isEnable;
        }

        /// <summary>
        /// 分支
        /// </summary>
        [Column("branch")]
        public virtual string Branch { get; set; } = "";

        /// <summary>
        /// 合并源分支
        /// </summary>
        [Column("branch_source")]
        public virtual string BranchSource { get; set; } = "";

        /// <summary>
        /// 使用次数
        /// </summary>
        [Column("use_count")]
        public virtual int UseCount { get; set; }

        /// <summary>
        /// 是否可用
        /// </summary>
        [Column("is_enable")]
        public virtual int IsEnable { get; set; }
    }
}
